/*
 * =====================================================================================
 *
 *       Filename:  yh_roce_dsp.c
 *
 *    Description:  
 *
 *        Version:  1.0
 *        Created:  08/14/2024 05:05:37 PM
 *       Revision:  none
 *       Compiler:  gcc
 *
 *         Author:  Yuan Yulei (yyl), yyl_nudt@qq.com
 *   Organization:  National University Defense of Technology
 *
 * =====================================================================================
 */
#include <stdint.h>
#include "dsp_config.h"




struct dsp_sw_roce_qp *qp;					//查询sq (for pi)
struct dsp_sw_remote_addr remote_addr;		//查询远端最新地址
//struct dsp_udp_connect_data* rconnect_data;	//查询对端建链信息 key 远端内存大小
struct dsp_sw_roce_mr* mr;					//查询本端最新可用地址\本端key
struct dsp_udp_connect_data* rconnect_data;
struct dsp_sw_roce_cq* cq;
/*
 * 以下函数需用先用C语言实现，再转换为汇编指令
 */

/*
 * 准备SQE
 * 从addr地址开始，在内存中写入SQE
 * 实参为DSP_MEM_ROCE_SQ_ADDR_V
 */
void
build_sqe(long unsigned int *addr)
{
	*addr = qp->qp_sq.wq_head + 1;				//31:0 wqe_idx			
	*(addr+4) = 0x00000003;						//63:48 imm低16位(0); 47:40 send_flags(0); 39:32 opcode(3：RC write操作)
	*(addr+8) =	rconnect_data->byte_4_sgeaddr32<<16 + 0x0000;	//95:80 remote_addr低16位(?); 79:64 imm高16位(0)
	*(addr+12) = rconnect_data->byte_8_sgeaddr32<<16+rconnect_data->byte_4_sgeaddr32>>16;	//127:96 remote_addr中间32位(?)
	*(addr+16) = rconnect_data->byte_12_rkey<<16+rconnect_data->byte_8_sgeaddr32>>16;		//159:144 rkey低16位(?); 143:128 remote_addr高16位(?)
	*(addr+20) = YH_ROCE_MR_DAT_SIZE_M<<16+rconnect_data->byte_12_rkey>>16;		//191:176 length远端内存大小低16位; 175:160 rkey高16位(?)
	*(addr+24) = mr->mr_startaddr_l<<16+YH_ROCE_MR_DAT_SIZE_M>>16;				//223:208 SQE缓冲区虚拟起始地址低16位; 207:192 length远端内存大小高16位(0)
	*(addr+28) = mr->mr_startaddr_h<<16+mr->mr_startaddr_l>>16;			//255:224 SQE缓冲区虚拟起始地址中间32位；
	*(addr+32) = YH_ROCE_SQ_MIN_SIZE_M<<16+mr->mr_startaddr_h>>16;				//287:272 sge_length低16位(8192:0x2000); 271:256 SQE缓冲区虚拟起始地址高16位
	*(addr+36) = mr->mr_key<<16+YH_ROCE_SQ_MIN_SIZE_M>>16;						//319:304 sge_lkey低16位(0); 303:288 sge_length高16位(0)
	*(addr+40) = mr->mr_key>>16;				//335:320 sge_lkey高16位(0)
}

/*
 * 准备RQE
 * 从addr地址开始，在内存中写入RQE
 * 实参为DSP_MEM_ROCE_RQ_ADDR_V
 */
void
build_rqe(unsigned int *addr)
{
	*addr = 0;
	*(addr+4) = qp->qp_rq.wq_startaddr_l;		//RQ缓冲区的起始地址低32位
	*(addr+8) = 0x0;						//RQ缓冲区的起始地址高32位
	*(addr+12) = YH_ROCE_RQ_MIN_SIZE_M;		//127:96 RQ缓冲区的长度
	*(addr+16) = mr->mr_key;				//159:128 本地键值 Lkey
}

/*
 * 准备data
 * 从addr地址开始，在内存中写入data, 1024Byte
 * 实参为DSP_MEM_ROCE_MR_ADDR_V
 */
void
build_dat(long unsigned int *addr)
{
	uint32_t data = 1;
	for (int i =0; i<(YH_ROCE_MR_DAT_SIZE_M/4); i++)
		*(addr+ 4*i) += data;
}

/*
 * 为Mailbox写入MRC
 * 起始地址为DSP_MEM_DEVI_MB_ADDR_V
 */
void
mailbox_mrc(unsigned int *addr)
{
	*addr = 0x00000001;				//31:8 PDN(0); 7:1 rev; 0 有效位(1 有效)
	*(addr+4) = mr->mr_key;			//Key值
	*(addr+8) = mr->mr_startaddr_l;	//MR的虚拟基地址，低32位
	*(addr+12) = 0x0;				//MR的虚拟基地址高32位
	*(addr+16) = mr->mr_size;		//159:128 MR空间长度(1024B) 
	*(addr+20) = mr->mr_mtr.mtr_startaddr_l;	//191:160 MTR表的物理基地址右移3位	
	*(addr+24) = 0x0;				//223:221 rev; 220:192 MTR表物理基地址高29bit
	*(addr+28) = 0x0000003;			//231:224 访问权限(3 local_read,local_write) 0x00000003&0x000000FF
}

/*
 * 为Mailbox写入CQC
 * 起始地址为DSP_MEM_DEVI_MB_ADDR_V
 */
void
mailbox_cqc(unsigned int *addr)
{
	//cq->cq_mtr.mtr_startaddr = DSP_MEM_ROCE_MTR_CQ_ADDR_V;
	*addr = 0x01000000;				//31:26 rev; 25 polling_en(0:轮询模式); 24 valid(CQ有效位 1); 23:0 cqn(0)
	*(addr+4) = cq->cq_mtr.mtr_startaddr_l;	//63:32 pba_l(CQ的MTR表的物理基地址右移3位,低32位)				
	*(addr+8) = 0x0;				//95:93 rev; 92:64 pba_h(CQ的MTR表的物理基地址右移3位,高29位)
	*(addr+12) = 0x0;				//127:112 cq_ci(0:CQ的CI指针); 111:96 cq_pi(0:CQ的PI指针)
	*(addr+16) = 0x0;				//159:144 cqe_cnt(0:CQE计数器); 143:128 cq_period(0:周期通知间隔)
	*(addr+20) = 0x0;				//191:160 cqe_report_timer(0:CQ 主动上报计时器的值)
	*(addr+24) = 0x00000056;		//215:209 rev; 208:200 irq_vector(0:CQ中断号); 199:196 log_cq_ws(5:32B,CQE宽度的对数值);195:192 log_cq_depth(6:64CQ的深度)
}

/*
 * 为Mailbox写入QPC
 * IBV_QPS_INIT
 * 起始地址为DSP_MEM_DEVI_MB_ADDR_V
 */
void
mailbox_qpc_init(unsigned int *addr)
{
	
	*addr = 0xf8000002;				//31:27可处理的最大消息长度的对数值，26:24 QP类型，23:0 QPN
	*(addr+4) = 0x0;				//rq_pba_l RQ的MTR表物理基地址,右移3位，取低32位
	*(addr+8) = 0x0;				//rq_pbl_h RQ的MTR表物理基地址,右移3位，取高29位，3bit保留位
	*(addr+12) = 0x0;				//sq_pba_l SQ的MTR表物理基地址,右移3位，取低32位
	*(addr+16) = 0x0;				//sq_pbl_h SQ的MTR表物理基地址,右移3位，取高29位，3bit保留位

	*(addr+20) = 0x0000005b;		//191:168 RQ的CQN(0)，167:164 RQE宽度对数值(5)，163:160 RQ深度对数值(b)
	*(addr+24) = 0x0000007b;		//223:200 SQ的CQN(0)，199:196 SQE宽度对数值(7)，195:192 SQ深度对数值(b)
	*(addr+28) = 0x04000000;		//255 保留位，254:251 IB版本号，250 QPC有效位，249 共享RQ使能，248 信用模式，247:224 QP绑定的PDN
	*(addr+32) = 0x0;				//287:285 rev，284 IP版本(IPV4)，283:280 MTU索引(0:512B)，279:256 共享RQ的num
	*(addr+36) = 0x0fff0080;		//319:317 rev，316 VLAN报文使能，315:304 vlan标签，303:296 流量类型，295:288 TTL字段
	*(addr+40) = 0x0;				//远端QPN低8位；流标签值；服务等级；（远端QPN设置为2）
	*(addr+44) = 0x0;				//远端QPN高16位；目的MAC低16位；
	*(addr+48) = 0x0;				//目的MAC高32位,
	
	/*目的GID	52、56、60、64*/
	// *(addr+52) = rconnect_data->gid[3]<<24+rconnect_data->gid[2]<<16+rconnect_data->gid[1]<<8+rconnect_data->gid[0];//远端GID不确定
	// *(addr+56) = rconnect_data->gid[7]<<24+rconnect_data->gid[6]<<16+rconnect_data->gid[5]<<8+rconnect_data->gid[4];
	// *(addr+60) = rconnect_data->gid[11]<<24+rconnect_data->gid[10]<<16+rconnect_data->gid[9]<<8+rconnect_data->gid[8];
	// *(addr+64) = rconnect_data->gid[15]<<24+rconnect_data->gid[14]<<16+rconnect_data->gid[13]<<8+rconnect_data->gid[12];
	*(addr+52) = 0x0;				//INIT状态GID设置为0
	*(addr+56) = 0x0;
	*(addr+60) = 0x0;
	*(addr+64) = 0x0;

	*(addr+68) = 0x0000127b;		//575:568 源MAC索引(0),567:560 源gid索引(0),559:544 UDP源端口号(十进制4731)
	*(addr+72) = 0x0;				//607:576 Q_KEY
	*(addr+76) = 0x01040000;		//639:636 读请求使能(0);635:632 QP状态(1);631:630 rev;629:608 响应频率(4)、重传次数、等待时间(0)
	*(addr+80) = 0x0;				//rq的PI和CI指针
	*(addr+84) = 0x0;				//sq的PI和CI指针
	*(addr+88) = 0x0;				//请求端初始化nPSN
	*(addr+92) = 0x0;				//响应端初始化ePSN
}

/*
 * 为Mailbox写入QPC
 * IBV_QPS_RTR 
 * 起始地址为DSP_MEM_DEVI_MB_ADDR_V
 */
void
mailbox_qpc_rtr(unsigned int *addr)
{
	//qp->qp_rq.mr_mtr.mtr_startaddr = DSP_MEM_ROCE_MTR_QP_ADDR_V;
	//qp->qp_sq.mr_mtr.mtr_startaddr = (DSP_MEM_ROCE_MTR_QP_ADDR_V+16);
	*addr = 0xf8000002;				//31:27可处理的最大消息长度的对数值，26:24 QP类型，23:0 QPN
	*(addr+4) = qp->qp_rq.mr_mtr.mtr_startaddr_l;	//rq_pba_l RQ的MTR表物理基地址,右移3位，取低32位
	*(addr+8) = qp->qp_rq.mr_mtr.mtr_startaddr_h;	//rq_pbl_h RQ的MTR表物理基地址,右移3位，取高29位，3bit保留位
	*(addr+12) = qp->qp_sq.mr_mtr.mtr_startaddr_l;	//sq_pba_l SQ的MTR表物理基地址,右移3位，取低32位
	*(addr+16) = qp->qp_sq.mr_mtr.mtr_startaddr_h;	//sq_pbl_h SQ的MTR表物理基地址,右移3位，取高29位，3bit保留位

	*(addr+20) = 0x000000b8;		//191:168 RQ的CQN，167:164 RQE宽度对数值，163:160 RQ深度对数值
	*(addr+24) = 0x000000d8;		//223:200 SQ的CQN，199:196 SQE宽度对数值，195:192 SQ深度对数值
	*(addr+28) = 0x04000000;		//255 保留位，254:251 IB版本号，250 QPC有效位，249 共享RQ使能，248 信用模式，247:224 QP绑定的PDN
	*(addr+32) = 0x0;				//287:285 rev，284 IP版本(IPV4)，283:280 MTU索引(0:512B)，279:256 共享RQ的num
	*(addr+36) = 0xffff0001;		//319:317 rev，316 VLAN报文使能，315:304 vlan标签，303:296 流量类型(0)，295:288 TTL字段(1)
	*(addr+40) = (rconnect_data->byte_16_qpn&0x000F)<<24;	//远端QPN低8位；流标签值；服务等级；（远端QPN设置为2）
	//目的mac对应83mac地址：12:93:82:ee:0c:3e
	*(addr+44) = 0x0c3e<<16+rconnect_data->byte_16_qpn>>8;	//远端QPN高16位；目的MAC低16位；
	*(addr+48) = 0x129382ee;		//目的MAC高32位
	
	/*目的GID	52、56、60、64*/
	*(addr+52) = rconnect_data->gid[3]<<24+rconnect_data->gid[2]<<16+rconnect_data->gid[1]<<8+rconnect_data->gid[0];//远端GID不确定
	*(addr+56) = rconnect_data->gid[7]<<24+rconnect_data->gid[6]<<16+rconnect_data->gid[5]<<8+rconnect_data->gid[4];
	*(addr+60) = rconnect_data->gid[11]<<24+rconnect_data->gid[10]<<16+rconnect_data->gid[9]<<8+rconnect_data->gid[8];
	*(addr+64) = rconnect_data->gid[15]<<24+rconnect_data->gid[14]<<16+rconnect_data->gid[13]<<8+rconnect_data->gid[12];

	*(addr+68) = 0x0000127b;		//575:568 源MAC索引(0),567:560 源gid索引(0),559:544 UDP源端口号(十进制4731)
	*(addr+72) = 0x0;				//607:576 Q_KEY
	*(addr+76) = 0x02040c00;		//639:636 读请求使能(b:0b1011,第一个1表示使能，011表示2^3=8，最大读请求数量8);635:632 QP状态(2);631:630 rev;629:608 响应频率、重传次数、等待时间(12)
	*(addr+80) = 0x0;				//rq的PI和CI指针
	*(addr+84) = 0x0;				//sq的PI和CI指针
	*(addr+88) = 0x0;				//请求端初始化nPSN
	*(addr+92) = 0x0;				//响应端初始化ePSN

}

/*
 * 为Mailbox写入QPC
 * IBV_QPS_RTS 
 * 起始地址为DSP_MEM_DEVI_MB_ADDR_V
 */
void
mailbox_qpc_rts(unsigned int *addr)
{
	//qp->qp_rq.mr_mtr.mtr_startaddr = DSP_MEM_ROCE_MTR_QP_ADDR_V;
	//qp->qp_sq.mr_mtr.mtr_startaddr = (DSP_MEM_ROCE_MTR_QP_ADDR_V+16);
	*addr = 0xf8000002;				//31:27可处理的最大消息长度的对数值，26:24 QP类型，23:0 QPN
	*(addr+4) = qp->qp_rq.mr_mtr.mtr_startaddr_l;	//rq_pba_l RQ的MTR表物理基地址,右移3位，取低32位
	*(addr+8) = qp->qp_rq.mr_mtr.mtr_startaddr_h;	//rq_pbl_h RQ的MTR表物理基地址,右移3位，取高29位，3bit保留位
	*(addr+12) = qp->qp_sq.mr_mtr.mtr_startaddr_l;	//sq_pba_l SQ的MTR表物理基地址,右移3位，取低32位
	*(addr+16) = qp->qp_sq.mr_mtr.mtr_startaddr_h;	//sq_pbl_h SQ的MTR表物理基地址,右移3位，取高29位，3bit保留位

	*(addr+20) = 0x000000b8;		//191:168 RQ的CQN，167:164 RQE宽度对数值，163:160 RQ深度对数值
	*(addr+24) = 0x000000d8;		//223:200 SQ的CQN，199:196 SQE宽度对数值，195:192 SQ深度对数值
	*(addr+28) = 0x04000000;		//255 保留位，254:251 IB版本号，250 QPC有效位，249 共享RQ使能，248 信用模式，247:224 QP绑定的PDN
	*(addr+32) = 0x0;				//287:285 rev，284 IP版本(IPV4)，283:280 MTU索引(0:512B)，279:256 共享RQ的num
	*(addr+36) = 0x0fff0001;		//319:317 rev，316 VLAN报文使能，315:304 vlan标签，303:296 流量类型，295:288 TTL字段
	*(addr+40) = (rconnect_data->byte_16_qpn&0x000F)<<24;	//远端QPN低8位；流标签值；服务等级；（远端QPN设置为2）
	//目的mac对应83mac地址：12:93:82:ee:0c:3e
	*(addr+44) = 0x0c3e<<16+rconnect_data->byte_16_qpn>>8;	//远端QPN高16位；目的MAC低16位；
	*(addr+48) = 0x129382ee;		//目的MAC高32位
	
	/*目的GID	52、56、60、64*/
	*(addr+52) = rconnect_data->gid[3]<<24+rconnect_data->gid[2]<<16+rconnect_data->gid[1]<<8+rconnect_data->gid[0];//远端GID不确定
	*(addr+56) = rconnect_data->gid[7]<<24+rconnect_data->gid[6]<<16+rconnect_data->gid[5]<<8+rconnect_data->gid[4];
	*(addr+60) = rconnect_data->gid[11]<<24+rconnect_data->gid[10]<<16+rconnect_data->gid[9]<<8+rconnect_data->gid[8];
	*(addr+64) = rconnect_data->gid[15]<<24+rconnect_data->gid[14]<<16+rconnect_data->gid[13]<<8+rconnect_data->gid[12];

	*(addr+68) = 0x0000127b;		//575:568 源MAC索引(0),567:560 源gid索引(0),559:544 UDP源端口号(十进制4731)
	*(addr+72) = 0x0;				//607:576 Q_KEY
	*(addr+76) = 0x03040cc0;		//639:636 读请求使能(b:0b1011,第一个1表示使能，011表示2^3=8，最大读请求数量8);635:632 QP状态(1);631:630 rev;629:608 响应频率、重传次数、等待时间(0)
	*(addr+80) = 0x0;				//rq的PI和CI指针
	*(addr+84) = 0x0;				//sq的PI和CI指针
	*(addr+88) = 0x0;				//请求端初始化nPSN
	*(addr+92) = 0x0;				//响应端初始化ePSN
}
/*
 * 发送报文敲Doorbell 
 * 起始地址为DSP_MEM_DEVI_DB_ADDR_V
 */
void
doorbell_send(unsigned int *addr)
{
	*addr = 0x00000002;				//31:24 doorbell需要处理的队列类型，0:SQ; 23:0 QPN (2) 
	*(addr+4) = 0x0;				//wqe编号，1个wqe

}

/**
 * 对qp赋值
 */
int dsp_qp_config(struct dsp_sw_roce_qp *qp){
	
	//u32 qpstartaddr=SQ0_HEAD_ADDR+qpn<<12;
    qp->qp_startaddr_l = 0xbf306000;			//QP起始地址的低32位
	qp->qp_startaddr_h = 0x00007f40;			//QP起始地址的高32位
    qp->qp_size=0x00050000;						//327680（0x50000）
    qp->qp_npages=0;
    qp->qp_key = 0;
    qp->qp_sq.wq_startaddr_l=0xbf306000;		//SQ的起始地址低32位
	qp->qp_sq.wq_startaddr_h=0x00007f40;		//SQ起始地址的高32位
	//qp->qp_sq.wq_size = 
	qp->qp_sq.wq_npages = 0x0;
	qp->qp_sq.wq_depth = 0x00000800;

	qp->qp_sq.mr_mtr.mtr_startaddr_l = 0x1ce5fe00;		//SQ的MTR表物理基地址(已右移3位)
	qp->qp_sq.mr_mtr.mtr_startaddr_h = 0x0;
	qp->qp_rq.mr_mtr.mtr_startaddr_l = 0x1ce5fe40;		//RQ的MTR表物理基地址(已右移3位)
	qp->qp_rq.mr_mtr.mtr_startaddr_h = 0x0;

    qp->qp_sq.wq_head=0;					//pi指针
    qp->qp_sq.wq_tail=0;					//ci指针
	qp->qp_sq.wqe_size = 0x40;
    qp->qp_qpn=2;							//qpn默认为2，qp从第2个开始
    qp->qp_cqn=0;							//cqn默认为0，所有qp都映射到第0个cq队列
    qp->qp_state=2;							//初始配置为1,INIT状态
    qp->qp_valid=1;							//状态固定为有效
	return 0;
}

/**
 * 建链交互信息赋值
 */
int dsp_rconnect_config(struct dsp_udp_connect_data* rconnect_data){

	rconnect_data->byte_4_sgeaddr32 = 0x02f65980;		//远端地址的低32位
	rconnect_data->byte_8_sgeaddr32 = 0x00005651;		//远端地址的高32位
	rconnect_data->byte_12_rkey = 0x0;					//远端rkey
	rconnect_data->byte_16_qpn = 2;						//远端qpn默认为2
	rconnect_data->byte_20_lid16 = 0x0;
	//设置GID，对应83的GID信息
	rconnect_data->gid[0]=0xfe;		rconnect_data->gid[1]=0x80;		rconnect_data->gid[2]=0x00;		rconnect_data->gid[3]=0x00;
	rconnect_data->gid[4]=0x00;		rconnect_data->gid[5]=0x00;		rconnect_data->gid[6]=0x00;		rconnect_data->gid[7]=0x00;
	rconnect_data->gid[8]=0x10;		rconnect_data->gid[9]=0x93;		rconnect_data->gid[10]=0x82;	rconnect_data->gid[11]=0xff;					
	rconnect_data->gid[12]=0xfe;	rconnect_data->gid[13]=0xee;	rconnect_data->gid[14]=0x0c;	rconnect_data->gid[15]=0x3e;					

	rconnect_data->psn24 = 0x0;							//包序号
	rconnect_data->rlength = 0x00050000;				//远端qp size
}


/**
 * cq赋值
 */
int dsp_cq_config(struct dsp_sw_roce_cq *cq){
	cq->cq_startaddr_l = 0xfb85b000;	//用户态驱动打印
	cq->cq_startaddr_h = 0x00007f32;
	cq->cq_size = 0x00100000;			//CQ地址空间大小32768*32=1048576（0x100000）
	cq->cq_npages = 0x0;
	cq->cq_mtr.mtr_startaddr_l = 0x1ce7fe00;	//CQ的MTR物理基地址已右移3位
	cq->cq_mtr.mtr_startaddr_h = 0x0;
	cq->cq_depth = 0x00008000;			//32768(0x8000)
	cq->cq_tail = 0x0;
	cq->cq_cqn = 0x0;
	cq->cq_valid = 0x00000001;

}



/**
 * mr赋值
 */
int dsp_mr_config(struct dsp_sw_roce_mr *mr){
	mr->mr_startaddr_l = 0x83119d90;
	mr->mr_startaddr_h = 0x00005648;
	mr->mr_size = 0x00000040;
	mr->mr_key = 0x0;
	mr->mr_pdn = 0x0;
	mr->mr_access = 0x00000007;
	mr->mr_npages = 0x0;
	mr->mr_mtr.mtr_startaddr_l = 0x1ce7fa00;	//MR的MTR物理基地址，已右移3位
	mr->mr_mtr.mtr_startaddr_h = 0x0;
}

void rhy_dsp_printinfo(long unsigned int *addr, int len)
{
	for (int  i = 0; i < len; i++)
	{
		printf("data: 0x%x\n",*(addr+(i*4)));
	}
}


void 
main()
{
	// struct dsp_sw_roce_qp sw_roce_qp;			//只有一个qp
	// struct dsp_sw_roce_cq sw_roce_cq;	
	// struct dsp_sw_roce_mr sw_roce_mr;
	printf("hello\n");

	dsp_qp_config(qp);
	dsp_cq_config(cq);
	dsp_mr_config(mr);
	dsp_rconnect_config(rconnect_data);

	mailbox_mrc(DSP_MEM_DEVI_MB_ADDR_V);
	printf("\n\n--------MRC INFO-------\n");
	rhy_dsp_printinfo(DSP_MEM_DEVI_MB_ADDR_V, 8);

	mailbox_cqc(DSP_MEM_DEVI_MB_ADDR_V);
	printf("\n\n--------CQC INFO-------\n");
	rhy_dsp_printinfo(DSP_MEM_DEVI_MB_ADDR_V, 7);

	mailbox_qpc_init(DSP_MEM_DEVI_MB_ADDR_V);
	printf("\n\n--------QPC_INIT INFO-------\n");
	rhy_dsp_printinfo(DSP_MEM_DEVI_MB_ADDR_V, 24);

	mailbox_qpc_rtr(DSP_MEM_DEVI_MB_ADDR_V);
	printf("\n\n--------QPC_RTR INFO-------\n");
	rhy_dsp_printinfo(DSP_MEM_DEVI_MB_ADDR_V, 24);

	mailbox_qpc_rts(DSP_MEM_DEVI_MB_ADDR_V);
	printf("\n\n--------QPC_RTS INFO-------\n");
	rhy_dsp_printinfo(DSP_MEM_DEVI_MB_ADDR_V, 24);

	build_sqe(DSP_MEM_ROCE_SQ_ADDR_V);
	printf("\n\n--------SQE INFO-------\n");
	rhy_dsp_printinfo(DSP_MEM_ROCE_SQ_ADDR_V, 11);

	build_dat(DSP_MEM_ROCE_MR_ADDR_V);
	printf("\n\n--------DATA INFO-------\n");
	rhy_dsp_printinfo(DSP_MEM_ROCE_MR_ADDR_V, 256);

	doorbell_send(DSP_MEM_DEVI_DB_ADDR_V);
	printf("\n\n--------DOORBELL INFO-------\n");
	rhy_dsp_printinfo(DSP_MEM_DEVI_DB_ADDR_V, 2);

	printf("========  END  ========\n");
}





